<template>
  <div class="header">
    <div class="header-left">
      <span class="iconfont back-icon">&#xe624;</span>
    </div>
    <div class="header-input">
      <span class="iconfont search-icon">&#xe632;</span>
      <input type="text" class="search" placeholder="输入城市/经典/游玩主题" />
    </div>
    <router-link to="/city">
      <div class="header-right">
        {{this.city}}
        <span class="iconfont arrow-icon">&#xe64a;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
export default {
  name: 'HomeHeader',
  props: {
    city: String
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="stylus" scoped>
  @import '~styles/varibles.styl'
  .header
    display:flex
    background: $bgColor
    line-height: $headerHeight
    /*优化代码，引入公用样式，bgColor和headerHeight，可在varibles.styl 中进行整体修改*/
    color: #fff
    .header-left
      width: .5rem
      float: left
      margin-left: .2rem
      .back-icon
        text-align: center
        font-size: .4rem
    .header-input
      flex: 1
      margin-left: .2rem
      position: relative
      /*margin-top: .12rem*/
      .search-icon
        color: #666
        position: absolute
        top: 50%
        left: 1%
        transform: translateY(-50%)
      .search
        width: 92%
        height: .64rem
        line-height: .64rem
        border-radius: .15rem
        padding-left: 1.4em
        background: #fff
        color: #666
    .header-right
      width: 1.24rem
      float: right
      color: #fff
      text-align: center
      .arrow-icon
        font-size: .25rem
</style>
